package com.graduation.books_borrow.Controller;

import com.graduation.books_borrow.Service.BooksQueryService;
import com.graduation.books_borrow.entity.Book;
import com.graduation.books_borrow.ret.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class BooksQueryController {

    @Autowired
    private BooksQueryService booksQueryService;

    @PostMapping("booksQuery")
    public R booksQuery(@RequestBody Map<String, String> map) {

        String bookName = map.get("bookName");
        String author = map.get("author");

        return booksQueryService.booksQuery(new Book(bookName, author));
    }

}
